/* 储存订单管理-客户管理-基础设置相关请求 */

import { ajaxService } from '@/utils/request';
import { PostClientSettingItem, PostClientCodeInfo } from '../type';

const env = import.meta.env;
let userURL = env.VITE_USER_BASE_URL;
let baseURL = env.VITE_CLIENT_URL;

/* 客户设置模块  */

// 获取客户设置数据
export function GetClientSettingInfo() {
  return ajaxService({
    url: '/client/getCustomerSet',
    method: 'get',
    baseURL,
  });
}

// 添加客户控件
export function PostClientSettingItem(data: PostClientSettingItem) {
  return ajaxService({
    url: '/client/addName',
    method: 'post',
    baseURL,
    data,
  });
}

// 删除客户控件
export function DeleteClientSettingItem(id: number) {
  return ajaxService({
    url: `/client/DeleteName/${id}`,
    method: 'delete',
    baseURL,
  });
}

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/* 客户跟进状态设置模块 */

// 获取客户跟进状态数据
export function GetClientStateSet() {
  return ajaxService({
    url: '/client/stateSet',
    method: 'get',
    baseURL,
  });
}

// 修改客户跟进状态数据
export function PostClientStateSet() {
  return ajaxService({
    url: '/client/postState',
    method: 'post',
    baseURL,
  });
}

// 修改客户跟进状态数据
export function PutClientStateSet(data: any) {
  return ajaxService({
    url: '/client/resultsSet',
    method: 'put',
    baseURL,
    data,
  });
}

// 删除一条状态
export function DelClientStateSet(id: number) {
  return ajaxService({
    url: `/client/stateCode/${id}`,
    method: 'delete',
    baseURL,
  });
}

/* ----------------------------------- ---------------------------------------------------------------------------------------------------------*/

/* 客户编号设置模块 */
// 新增或修改客户编号设置
export function postClientNumSet(data: any) {
  return ajaxService({
    url: '/client/customer/numSet',
    method: 'post',
    data,
    baseURL,
  });
}

// 上传
export function PostUpload(data: any) {
  return ajaxService({
    url: '/basis/basis/file/upload',
    method: 'post',
    baseURL: userURL,
    data,
  });
}
